<HTML><HEAD>
<!--

    ------------
    Slot Machine
    ------------
-->

<SCRIPT LANGUAGE="JavaScript"><!-- hide from old browsers

/*
    THE JAVASCRIPT COOKBOOK by Erica Sadun, webrx@mindspring.com
    Copyright (c)1998 by Charles River Media.  All Rights Reserved.
    
    This applet can only be re-used or modifed by license holders of the
    JavaScript Cookbook CD-ROM.  Credit must be given in the source
    code and this copyright notice must be maintained. If you do
    not hold a license to the JavaScript Cookbook, you may NOT
    duplicate or modify this code for your own use.

    Use at your own risk. No warranty is given or implied of the suitability 
    of this applet for any specific application. Neither Erica Sadun nor 
    Charles River Media will be held responsible for any unwanted effects 
    due to the use of this applet or any derivative. 
*/

//------------------RANDOM NUMBERS----------------------------
var js_mult1=3141
var js_mult2=5821
var js_m1=100000000
var js_m2=10000
var js_iseed=0
var js_iseed1=0
var js_iseed2=0


// Return a Random Integer between 0 and N-1
function random(n)
{
    if (js_iseed == 0)
    {
        now = new Date()
        js_iseed = now.getHours() + now.getMinutes() * 60 
                    + now.getSeconds() * 3600
    }
    js_iseed1 = js_iseed / js_m2
    js_iseed2 = js_iseed % js_m2
    var tmp = (((js_iseed2 * js_mult1 + js_iseed1 * js_mult2) % js_m2) * 
                js_m2 + (js_iseed2 * js_mult2)) % js_m1
    js_iseed = (tmp + 1) % js_m1
    return (Math.floor((js_iseed/js_m1) * n))
}

<!-- done hiding --></SCRIPT></HEAD>

<BODY bgcolor="ffffff" link="0000ff" vlink="770077">
    
<FONT COLOR="007777"><H1><IMG SRC="../GRAFX/SPICE.JPG" WIDTH=37 HEIGHT=72
ALIGN = LEFT>Casino JavaScript</H1></FONT>

<BLOCKQUOTE><FONT COLOR="770000">The Smile Slot Machine<p></FONT>

    <CENTER><SCRIPT>
        var emot1 = "FROWN"
        var emot2 = "FROWN"
        var emot3 = "FROWN"
        var nwin = 0        
        
        if (random(2) == 1) {emot1 = "SMILE"; nwin++}
        if (random(2) == 1) {emot2 = "SMILE"; nwin++}
        if (random(2) == 1) {emot3 = "SMILE"; nwin++}
        
        document.write("<IMG src=\"../GRAFX/"+emot1+".GIF\" HEIGHT=64 WIDTH=64>")
        document.write("<IMG src=\"../GRAFX/"+emot2+".GIF\" HEIGHT=64 WIDTH=64>")
        document.write("<IMG src=\"../GRAFX/"+emot3+".GIF\" HEIGHT=64 WIDTH=64>")
        document.write("<br>")
        
        if (nwin == 3)
            document.write("<h1>You Win!</h1>")
        else
            document.write("<h1>Sorry...Not a Winner</h1>")
            
    </SCRIPT></CENTER>
    
</BLOCKQUOTE>
    
    <CENTER><FORM>
        <INPUT TYPE="BUTTON" VALUE="      PULL THE LEVER      "
            onClick="parent.JCcontent.history.go(0)">
    </FORM></CENTER>
    
    <br><br>
    
    <FONT COLOR="007777"><H2>Discussion</H2></FONT>
    <FONT SIZE=4>
        The Smile Slot Machine flips a coin three times. If each
        time the player gets "heads" (a smile), he wins. Any frown
        and he loses. The reload button at the bottom of the game
        works by telling Netscape to backup--by zero documents--in
        the history stack.  This is, of course, the same document.
        Netscape causes the document to reload.
    </FONT>    
    <FONT COLOR="770000"><PRE><null
    >&lt;INPUT TYPE="BUTTON" VALUE="      PULL THE LEVER      "<br><null
    >    onClick="parent.JCcontent.history.go(0)"&gt;<br><null
    ></PRE></FONT>
    

<h5>Copyright &copy;1996 by Charles River Media, All Rights Reserved</h5>
</BODY>
</HTML>